home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume0 / awm / part05 < prev    next >
Encoding:
Internet Message Format  |  1988-08-09  |  55.1 KB

  1. Path: uunet!wyse!mikew
  2. From: mikew@wyse.wyse.com (Mike Wexler)
  3. Newsgroups: comp.sources.x
  4. Subject: v00i006:  Ardent Window Manager(x11), Part05/13
  5. Message-ID: <1629@wyse.wyse.com>
  6. Date: 9 Aug 88 17:18:58 GMT
  7. Sender: news@wyse.wyse.com
  8. Lines: 1811
  9. Approved: mikew@wyse.com
  10.  
  11. Submitted-by: jkh@ardent (Jordan Hubbard)
  12. Posting-number: Volume 0, Issue 6
  13. Archive-name: awm/part05
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 5 (of 13)."
  22. # Contents:  awm/CHANGES awm/Gadget.c awm/GridBox.c awm/Move.c
  23. #   awm/README awm/menus/rtlmenu.c
  24. # Wrapped by mikew@wyse on Mon Aug  8 12:01:43 1988
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f awm/CHANGES -a "${1}" != "-c" ; then 
  27.   echo shar: Will not over-write existing file \"awm/CHANGES\"
  28. else
  29. echo shar: Extracting \"awm/CHANGES\" \(9022 characters\)
  30. sed "s/^X//" >awm/CHANGES <<'END_OF_awm/CHANGES'
  31. XThis file last changed: 7/2/88
  32. X
  33. XThe most recent changes to awm include:
  34. X
  35. XBorder/title context rationalized, you may now have border contexts without
  36. Xtitle bars and vice-versa.
  37. X
  38. XThe whole paradigm for adding/removing various decorations has changed.
  39. XFunctions such as f.notitle and f.gadget have been replaced with the
  40. Xtwo functions f.decorate and f.nodecorate for reasons of simplicity.
  41. XIt's now possible to specify on an application-by-application (or class-by
  42. Xclass) basis which "decorations" not to use. See the SPECIAL RESOURCES
  43. Xsection of the man page for more information.
  44. X
  45. XFocus In/Out and Enter/Leave event handling now much more robust and
  46. Xhighlighting occurs when it should.
  47. X
  48. Xf.unfocus added for twm compatibility (not to mention general convenience).
  49. X
  50. XThe window name is now centered correctly in the titlebar (the net result
  51. Xbeing that the titlebar background doesn't creep around the edges the way
  52. Xit used to).
  53. X
  54. Xdef.awmrc/system.awmrc ambiguity finally resolved in favor of system.awmrc.
  55. XThe man page and makefile should now agree on this one.
  56. X
  57. XMany bugs and general nits fixed.
  58. X
  59. XTwo lines of whitespace added after #ident lines to keep patch from
  60. Xincluding them in context information (for those who have removed them).
  61. X
  62. XThings have been sped up a bit.
  63. X
  64. X
  65. XPrevious changes to awm:
  66. X
  67. XVersion numbers set to 1.1 in all files. Subsequent versions of awm will
  68. Xincrement this accordingly (major_release.fix_level).
  69. X
  70. XMenus should now work on color systems.
  71. X
  72. XWeird nit with XGetClassHint() that caused coredumps fixed.
  73. X
  74. XMan page re-written substantially (Thanks to Bill Wohler), the format
  75. Xof the resource descriptions below reflect part of his changes.
  76. X
  77. XNew make rule "noident" added for awm and awm/menus makefile. Doing
  78. Xa "make noident" in the awm directory will remove all #ident lines from
  79. Xawm and the menus. We use #ident at ardent without trouble (and on the
  80. Xsuns), but it seems to choke DEC's compilers. I'm not sure if this
  81. Xis legal ansi anymore or not. In any case, if #ident chokes your compiler,
  82. Xthis will remove it.
  83. X
  84. XNew resources:
  85. X
  86. XFrameFocus (boolean) ``off''
  87. X Specifies whether or not focus changes should be looked for on the
  88. X client window (as they are now) or on the frame.
  89. X In a nutshell, if you set this to "off", the window will be not
  90. X change state (be this highlight or stacking level) until you've
  91. X left the frame (this includes the title bar) entirely. Correspondingly,
  92. X enter highlight/autoraise is also done on the whole frame.
  93. X This resource also has the side-effect of making the focus follow the
  94. X pointer explicitly. Thus typing into titlebars will cause the keyboard input
  95. X to go to the client window as expected.
  96. Xborder.foreground (string) ``foreground''
  97. X Lets you specify the border color for awm's "frame" windows.
  98. X
  99. X
  100. XChanges as of 6/6/88
  101. XNew resources:
  102. X
  103. XwindowName.offset: (int)
  104. X Specifys an offset for the window name, rather than
  105. X centering it.
  106. X
  107. Xtitle.height: (int)
  108. X Allows you to physically set the height of titlebars (in pixels)
  109. X to some value, rather than having it be derived from the size of
  110. X the title font(s).
  111. X
  112. Xgadget.border: (int)
  113. X Allows you to set the width of gadget box borders to some
  114. X value.
  115. X
  116. Xborder.hilite: (boolean)
  117. X Specifies whether or not to change border colors on focus in/out.
  118. X If this is undefined, and hilite is, it is set to the value of
  119. X hilite. Since is was already possible to specify whether or not
  120. X the window name and title background would be affected by focus
  121. X changes, this resource rounds out the list.
  122. X
  123. XFor demonstration purposes are two files "twm.awmrc" and "twm.Xdefaults"
  124. Xthat can be used to make awm look very much like twm. If you want to try
  125. Xthis out, edit twm.Xdefaults so that the awm.path variable points to
  126. X/.../awm/bitmaps and load it into your resource manager.
  127. X
  128. X
  129. XA few more bugs were fixed. Pixmap icons should now stay sane.
  130. XBad gravity specifications should be handled gracefully.
  131. Xcursor glyph gadget boxes should now be the correct size.
  132. XA problem with FocusChange was fixed.
  133. XThe restriction of compiling XRdBitFD only with Xlib has been lifted.
  134. X
  135. XAutoselect now works in submenus. Menu item positioning has been
  136. Ximproved.
  137. X
  138. XChanges as of 6/3/88:
  139. X
  140. XBug fixes/enhancements for first release.
  141. X
  142. XA new context named "border" has been added. When enabled (by giving it a width, see
  143. Xman page), it results in an artificial border area to which actions may be bound.
  144. XSee the man page for information on configuring this.
  145. X
  146. XIt is now possible to bind to "text action" strings in the same manner as functions
  147. Xand menus. Specifically, you may now invoke programs and manipulate the cut buffer
  148. Xdirectly through bindings rather than having to go through menus. See the man
  149. Xpage for a more thorough explanation.
  150. X
  151. XCursors for title bars and border contexts (new) are now definable resources.
  152. X
  153. X"resizeRelative" option from R2 uwm folded in along with uwm bug fixes.
  154. X
  155. XNew title.push option allows you to specify whether you want titles to push windows
  156. Xdown to make room (the default) or be added on top without moving them.
  157. X
  158. XSupport for the RTL Neaten package has been added. See the README file if you
  159. Xwish to compile it in.
  160. X
  161. XTo avoid some confusion, it's now manadatory that you compile XRdBitFD.c into Xlib.
  162. XSeperate compilation is no longer supported. The resulting inconvenience is relatively
  163. Xminor compared to what some people with irregular source trees experienced when trying
  164. Xto compile it as part of awm.
  165. X
  166. XMany bugs have been fixed, most notably a race condition on window mapping,
  167. Xmapping/unmapping of windows, bogus event masks to gadgets, resize weirdness,
  168. Xrubber banding and a number of coordinate botches that resulted from
  169. Xadding frames around things. It's now possible to compile awm with gcc 1.22,
  170. Xthough I don't know about the neaten package.
  171. X
  172. X
  173. XBug fixes to Beta.3
  174. X
  175. XDEF_FONT is now in awm.h where it belongs and GetFontRes() has been
  176. Xmodified to use it.
  177. X
  178. XSome of the default specs in awm.h have been ifdef'd so that you can
  179. Xalso specify them at compile time. Currently, you can do this for the font specs:
  180. X
  181. XNAME            Default value
  182. X----            -------------
  183. XDEF_FONT        "fixed"
  184. XDEF_TITLE_FONT        "vtsingle"
  185. XDEF_ICON_FONT        "8x13"
  186. XDEF_POPUP_FONT        "9x15"
  187. XDEF_GADGET_FONT        "fixed"
  188. XDEF_MENU_FONT        "8x13"
  189. XDEF_BOLD_FONT        "8x13bold"
  190. X
  191. XAnd the name and class of awm:
  192. X
  193. XNAME            "awm"
  194. XCLASS            "Wm"
  195. X
  196. XIt's still suggested that you change them in awm.h when you're configuring
  197. Xawm for your site, but this gives you an additional way of setting them.
  198. X
  199. XChanges for beta release 3.
  200. X
  201. X1. Total rewrite of Iconify.c and NewIconify, problems fixed are iconic
  202. Xstartup, icon/window positioning, icon_mask hints.
  203. X
  204. X2. Each gadget may now have its own font, rather than having to
  205. Xuse a global gadget font (though this is still the default).
  206. XNon-printable characters can also now be specified, allowing you
  207. Xto grab individual glyphs out of fonts and use them in gadgets.
  208. XThe is probably most useful for getting things out of the cursor font.
  209. XSee the man page for details.
  210. XNote: Though much of the necessary code is in place, it still is not
  211. Xpossible to use 16 bit fonts for this purpose. Though I'd love
  212. Xto have gadgets containing Kanji glyphs (a picture is worth a thousand
  213. Xwords, especially in Kanji) and the like, I still don't know enough
  214. Xabout the mechanism to know how and when to use the X*Text*16 routines,
  215. Xor how to store the "string" in such a way that it could be
  216. Xpainted into an 8 bit font as well.
  217. X
  218. X3. Overall structure of the window manager has changed slightly.
  219. XThe code should be easier to read and debug.
  220. X
  221. X4. New "wall" boolean allows you to constrain moves to the edges of
  222. Xthe screen.
  223. X
  224. X5. Some things that should have been getting their colors out of
  225. Xthe resource database now do.
  226. X
  227. X6. Window name and class are now both checked when determing whether
  228. Xor not to title a window.
  229. X
  230. X7. Icons now use save-unders.
  231. X
  232. X8. Certain operations should be faster.
  233. X
  234. X9. The man page has been made more readable and updated somewhat.
  235. X
  236. X
  237. XCHANGES OVER UWM:
  238. X
  239. XThis window manager represents a fairly large departure from uwm
  240. Xin the following ways:
  241. X
  242. X o    There are title bars and gadget boxes that represent fully independent
  243. X    contexts now (I.E. you can bind to them without conflict).
  244. X
  245. X o    Icons now represent a truly independent context.
  246. X
  247. X o    The menus have changed completely to allow walking menus and
  248. X    more flexibility as to contents (pictures or text) of individual panes.
  249. X    The menu interface has also been de-coupled somewhat from awm so
  250. X    that another menu package could be substituted at a
  251. X    later date. When an "official" toolkit menu widget exists, this
  252. X    will probably happen.
  253. X
  254. X o    Boolean variables may be set within menus and are also displayed
  255. X    with a checkmark (depending on whether or not they're set).
  256. X
  257. X o    Some effort is made to use save-unders and/or to minimize expose
  258. X    events due to window manager actions.
  259. X
  260. X o    Autoraise and border highlighting are available on focus.
  261. X
  262. X o    Almost everything has been moved out of the .awmrc file and into
  263. X    the resource database where it belongs.
  264. X
  265. X o    awm now supports a startup file that makes usage from xinit more
  266. X    friendly.
  267. X
  268. END_OF_awm/CHANGES
  269. if test 9022 -ne `wc -c <awm/CHANGES`; then
  270.     echo shar: \"awm/CHANGES\" unpacked with wrong size!
  271. fi
  272. # end of overwriting check
  273. fi
  274. if test -f awm/Gadget.c -a "${1}" != "-c" ; then 
  275.   echo shar: Will not over-write existing file \"awm/Gadget.c\"
  276. else
  277. echo shar: Extracting \"awm/Gadget.c\" \(8862 characters\)
  278. sed "s/^X//" >awm/Gadget.c <<'END_OF_awm/Gadget.c'
  279. X#ident   "%W% %G%"
  280. X
  281. X
  282. X
  283. X#ifndef lint
  284. Xstatic char *rcsid_Gadget_c = "$Header: Gadget.c,v 1.3 88/07/23 17:26:00 jkh Exp $";
  285. X#endif  lint
  286. X
  287. X#include "X11/copyright.h"
  288. X/*
  289. X *
  290. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  291. X *
  292. X * Copyright 1987 by Jordan Hubbard.
  293. X *
  294. X *
  295. X *                         All Rights Reserved
  296. X *
  297. X * Permission to use, copy, modify, and distribute this software and its
  298. X * documentation for any purpose and without fee is hereby granted,
  299. X * provided that the above copyright notice appear in all copies and that
  300. X * both that copyright notice and this permission notice appear in
  301. X * supporting documentation, and that the name of Ardent Computer
  302. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  303. X * pertaining to distribution of the software without specific, written
  304. X * prior permission.
  305. X *
  306. X */
  307. X
  308. X/*
  309. X * MODIFICATION HISTORY
  310. X *
  311. X * 001 -- Jortan Hubbard, Ardent Computer.
  312. X * Gadget boxes in title bars.
  313. X * 1.2 -- Jordan Hubbard, Ardent Computer.
  314. X *  GadgetBorders used in placement calculations, initial
  315. X *  gadget positions calculated correcly. (Chris Thewalt fixes).
  316. X * 1.3 -- Color handling changed to deal with multiple colormaps.
  317. X *
  318. X */
  319. X
  320. X#include "awm.h"
  321. X#include "X11/Xutil.h"
  322. X
  323. Xextern XContext AwmContext;
  324. X
  325. XAwmInfoPtr IsGadgetWin(w, gnum)
  326. XWindow w;
  327. Xint *gnum;
  328. X{
  329. X     AwmInfoPtr awi;
  330. X     int i;
  331. X
  332. X     Entry("IsGadgetWin")
  333. X
  334. X     if (!XFindContext(dpy, w, AwmContext, &awi)) {
  335. X      Window *wp;
  336. X
  337. X          if (!awi->gadgets)
  338. X               Leave((AwmInfoPtr)NULL)
  339. X      for (i = 0; i < NumGadgets; i++)
  340. X           if (awi->gadgets[i] == w) {
  341. X                    if (gnum)
  342. X                    *gnum = i;
  343. X                Leave(awi)
  344. X               }
  345. X          Leave((AwmInfoPtr)NULL)
  346. X     }
  347. X}
  348. X
  349. X/*
  350. X * This routine adds and/or places  gadgets onto a title bar.
  351. X */
  352. Xint PutGadgets(w)
  353. XWindow w;
  354. X{
  355. X     int i, dir;
  356. X     int rx, lx, nx, ny;
  357. X     XWindowAttributes xwa;
  358. X     XSetWindowAttributes swa;
  359. X     Colormap cmap;
  360. X     unsigned long valuemask;
  361. X     GadgetDecl *gdec;
  362. X     AwmInfo *awi;
  363. X     char *cp;
  364. X     Boolean change = FALSE;
  365. X     Binding *bptr;
  366. X     Window tmp;
  367. X
  368. X     Entry("PutGadgets")
  369. X
  370. X     /* are there any gadgets declared? */
  371. X     if (NumGadgets < 1)
  372. X      Leave_void
  373. X     /* does this window have a title? */
  374. X     if (!(awi = IsTitled(w)))
  375. X      Leave_void
  376. X
  377. X     if (!(awi->attrs & AT_GADGETS))
  378. X      Leave_void
  379. X     /* if the window already has gadgets, this is a reshuffle */
  380. X     if (awi->gadgets)
  381. X      change = TRUE;
  382. X     else
  383. X      awi->gadgets = (Window *)malloc(sizeof(Window) * NumGadgets + 1);
  384. X     if (!awi->gadgets) {
  385. X      fprintf(stderr, "PutGadgets: Can't allocate memory for gadgets!\n");
  386. X          Leave(FALSE)
  387. X     }
  388. X     if (XGetWindowAttributes(dpy, awi->title, &xwa) == BadWindow) {
  389. X      fprintf(stderr, "PutGadgets: Can't get attrs for client window %x\n",
  390. X          w);
  391. X      Leave_void
  392. X     }
  393. X     /* define some initial positioning information */
  394. X     dir = RightGadgetGravity;
  395. X     lx = 0;
  396. X     rx = xwa.width;
  397. X     cmap = xwa.colormap;
  398. X     valuemask = CWBackPixel | CWEventMask | CWColormap;
  399. X     swa.event_mask = (ButtonPressMask | ButtonReleaseMask | ExposureMask);
  400. X     swa.colormap = cmap;
  401. X     for (i = 0; i < NumGadgets && Gadgets[i]; i++) {
  402. X      XGCValues gcv;
  403. X
  404. X      gdec = Gadgets[i];
  405. X
  406. X      /* Does gadget have its own gravity? */
  407. X      if (gdec->gravity != NoGadgetGravity)
  408. X           dir = gdec->gravity;
  409. X      ny = xwa.height - gdec->high;
  410. X      if (ny <= 0) {
  411. X           ny = 0;
  412. X               gdec->high = xwa.height;
  413. X          }
  414. X      else
  415. X           ny = (ny / 2) - 1;
  416. X      if (ny < 0)
  417. X           ny = 0;
  418. X      if (dir == LeftGadgetGravity) {
  419. X           nx = lx + gdec->offset + GadgetBorder;
  420. X           if (lx != 0) /* not first time through, add pad */
  421. X            nx = lx + GadgetPad;
  422. X           if (nx < 0)
  423. X            nx = 0;
  424. X           lx = nx + gdec->wide;
  425. X               dir = RightGadgetGravity;
  426. X      }
  427. X      else if (dir == RightGadgetGravity) {    
  428. X           nx = rx - gdec->wide - gdec->offset - (2 * GadgetBorder);
  429. X           if (rx != xwa.width)
  430. X            nx -= GadgetPad;
  431. X           rx = nx - GadgetBorder;
  432. X               dir = LeftGadgetGravity;
  433. X      }
  434. X      else /* Center Gravity */
  435. X           nx = ((xwa.width - gdec->wide) / 2) + gdec->offset;
  436. X      if (change == FALSE || !awi->gadgets[i]) {
  437. X           swa.background_pixel = GetPixel(gdec->backcolor, cmap);
  438. X           tmp = awi->gadgets[i] = XCreateWindow(dpy, awi->title, nx, ny,
  439. X                             gdec->wide, gdec->high,
  440. X                             GadgetBorder,
  441. X                             xwa.depth, xwa.class,
  442. X                             xwa.visual, valuemask,
  443. X                             &swa);
  444. X           if (!tmp) {
  445. X            fprintf(stderr, "PutGadgets: Can't create gadget #%d\n",
  446. X                i);
  447. X            Leave_void
  448. X           }
  449. X           if (gdec->data) {
  450. X            Pixmap pix;
  451. X
  452. X            pix = XCreatePixmapFromBitmapData(dpy, tmp, gdec->data,
  453. X                              gdec->wide, gdec->high,
  454. X                              GetPixel(gdec->forecolor, cmap),
  455. X                              GetPixel(gdec->backcolor, cmap),
  456. X                              xwa.depth);
  457. X            if (!pix) {
  458. X             fprintf(stderr, "PutGadgets: Unable to create pixmap for #%d\n",
  459. X                 i);
  460. X                         fprintf(stderr, "Using grey...\n");
  461. X                         pix = GrayPixmap;
  462. X            }
  463. X            XSetWindowBackgroundPixmap(dpy, tmp, pix);
  464. X            XFreePixmap(dpy, pix);
  465. X           }
  466. X           XMapWindow(dpy, tmp);
  467. X           XSaveContext(dpy, tmp, AwmContext, awi);
  468. X      }
  469. X      else
  470. X           XMoveWindow(dpy, awi->gadgets[i], nx, ny);
  471. X     }
  472. X     if (change == FALSE) /* make sure the window array is null terminated */
  473. X          awi->gadgets[i] = (Window)NULL;
  474. X     PaintGadgets(w);
  475. X     Leave_void
  476. X}
  477. X
  478. Xint FreeGadget(n)
  479. Xint n;
  480. X{
  481. X     Entry("FreeGadget")
  482. X
  483. X     if (Gadgets[n]->data)
  484. X      XFree(Gadgets[n]->data);
  485. X     if (Gadgets[n]->name)
  486. X      free(Gadgets[n]->name);
  487. X}
  488. X
  489. Xint CheckGadgets()
  490. X{
  491. X     int i, status = 0;
  492. X
  493. X     Entry("CheckGadgets")
  494. X
  495. X     for (i = 0; i < NumGadgets; i++)
  496. X      if (!Gadgets[i]) {
  497. X           fprintf(stderr, "awm: Gadget #%d is not declared!\n",
  498. X               i);
  499. X           fprintf(stderr, "All gadgets from 0 to %d must be declared.\n",
  500. X               NumGadgets - 1);
  501. X           status = 1;
  502. X      }
  503. X     Leave(status)
  504. X}
  505. X
  506. XBoolean ResetGadgets()
  507. X{
  508. X     int i;
  509. X
  510. X     Entry("ResetGadgets")
  511. X
  512. X     for (i = 0; i < NumGadgets; i++) {
  513. X      FreeGadget(i);
  514. X      free(Gadgets[i]);
  515. X      Gadgets[i] = 0;
  516. X     }
  517. X     NumGadgets = 0;
  518. X}
  519. X     
  520. Xint DestroyGadgets(w)
  521. XWindow w;
  522. X{
  523. X     int i;
  524. X     AwmInfoPtr awi;
  525. X
  526. X     Entry("DestroyGadgets")
  527. X
  528. X     if (!(awi = IsTitled(w)))
  529. X      Leave_void
  530. X     if (!awi->gadgets)
  531. X      Leave_void
  532. X     for (i = 0; i < NumGadgets && Gadgets[i]; i++) {
  533. X      XDeleteContext(dpy, awi->gadgets[i], AwmContext);
  534. X      XDestroyWindow(dpy, awi->gadgets[i]);
  535. X     }
  536. X     free(awi->gadgets);
  537. X     awi->gadgets = 0;
  538. X     Leave_void
  539. X}
  540. X
  541. Xint PaintGadgets(w)
  542. XWindow w;
  543. X{
  544. X     int i, y, x = 0;
  545. X     AwmInfoPtr awi;
  546. X     GadgetDecl *gdec;
  547. X     XWindowAttributes xwa;
  548. X
  549. X     Entry("PaintGadgets")
  550. X
  551. X     if (!(awi = IsTitled(w)))
  552. X      Leave_void
  553. X     if (!awi->gadgets)
  554. X      Leave_void
  555. X     XGetWindowAttributes(dpy, awi->client, &xwa);
  556. X     for (i = 0; i < NumGadgets && Gadgets[i]; i++) {
  557. X      gdec = Gadgets[i];
  558. X      if (!gdec->data) {
  559. X           XGCValues gcv;
  560. X
  561. X           gcv.font = gdec->fontInfo->fid;
  562. X           gcv.foreground = GetPixel(gdec->forecolor, xwa.colormap);
  563. X           gcv.background = GetPixel(gdec->backcolor, xwa.colormap);
  564. X           XChangeGC(dpy, awi->winGC, (GCFont | GCForeground |
  565. X                       GCBackground), &gcv);
  566. X           if (strlen(gdec->name) == 1) { /* it's a glyph (we think) */
  567. X            XFontStruct *real_font;
  568. X            XCharStruct char_info;
  569. X            int char_number, index, byte1, byte2;
  570. X
  571. X            real_font = gdec->fontInfo;
  572. X            char_number = gdec->name[0];
  573. X            char_info = real_font->max_bounds;
  574. X            index = char_number;
  575. X
  576. X            if (real_font->per_char) {
  577. X             if (!real_font->min_byte1 && !real_font->max_byte1) {
  578. X                  if (char_number < real_font->min_char_or_byte2 ||
  579. X                  char_number > real_font->max_char_or_byte2)
  580. X                   index = real_font->default_char;
  581. X                  index -= real_font->min_char_or_byte2;
  582. X             } else {
  583. X                  byte2 = index & 0xff;
  584. X                  byte1 = (index>>8) & 0xff;
  585. X                  if (byte1 < real_font->min_byte1 ||
  586. X                  byte1 > real_font->max_byte1 ||
  587. X                  byte2 < real_font->min_char_or_byte2 ||
  588. X                  byte2 > real_font->max_char_or_byte2) {
  589. X                   byte2 = real_font->default_char & 0xff;
  590. X                   byte1 = (real_font->default_char>>8)&0xff;
  591. X                  }
  592. X                  byte1 -= real_font->min_byte1;
  593. X                  byte2 -= real_font->min_char_or_byte2;
  594. X                  index = byte1 * (real_font->max_char_or_byte2 -
  595. X                           real_font->min_char_or_byte2 + 1) +
  596. X                            byte2;
  597. X             }
  598. X             char_info = real_font->per_char[index];
  599. X            }
  600. X            x = 1 - GadgetBorder - char_info.lbearing;
  601. X            y = char_info.ascent;
  602. X           }
  603. X           else {
  604. X            y = (gdec->high + (gdec->fontInfo->max_bounds.ascent -
  605. X                       gdec->fontInfo->max_bounds.descent)) / 2;
  606. X            x = GadgetBorder;
  607. X           }
  608. X           XDrawString(dpy, awi->gadgets[i], awi->winGC, x,
  609. X               y, gdec->name, strlen(gdec->name));
  610. X      }
  611. X     }
  612. X     Leave(0)
  613. X}
  614. END_OF_awm/Gadget.c
  615. if test 8862 -ne `wc -c <awm/Gadget.c`; then
  616.     echo shar: \"awm/Gadget.c\" unpacked with wrong size!
  617. fi
  618. # end of overwriting check
  619. fi
  620. if test -f awm/GridBox.c -a "${1}" != "-c" ; then 
  621.   echo shar: Will not over-write existing file \"awm/GridBox.c\"
  622. else
  623. echo shar: Extracting \"awm/GridBox.c\" \(7858 characters\)
  624. sed "s/^X//" >awm/GridBox.c <<'END_OF_awm/GridBox.c'
  625. X#ident   "%W% %G%"
  626. X
  627. X
  628. X
  629. X#ifndef lint
  630. Xstatic char *rcsid_StoreGridBox_c = "$Header: GridBox.c,v 1.1 88/06/15 15:21:55 jkh Exp $";
  631. X#endif    lint
  632. X
  633. X#include "X11/copyright.h"
  634. X/*
  635. X *
  636. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  637. X *
  638. X * Copyright 1987 by Jordan Hubbard.
  639. X *
  640. X *
  641. X *                         All Rights Reserved
  642. X *
  643. X * Permission to use, copy, modify, and distribute this software and its
  644. X * documentation for any purpose and without fee is hereby granted,
  645. X * provided that the above copyright notice appear in all copies and that
  646. X * both that copyright notice and this permission notice appear in
  647. X * supporting documentation, and that the name of Ardent Computer
  648. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  649. X * pertaining to distribution of the software without specific, written
  650. X * prior permission.
  651. X *
  652. X */
  653. X
  654. X/*
  655. X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  656. X *
  657. X *                         All Rights Reserved
  658. X *
  659. X * Permission to use, copy, modify, and distribute this software and its
  660. X * documentation for any purpose and without fee is hereby granted,
  661. X * provided that the above copyright notice appear in all copies and that
  662. X * both that copyright notice and this permission notice appear in
  663. X * supporting documentation, and that the name of Digital Equipment
  664. X * Corporation not be used in advertising or publicity pertaining to
  665. X * distribution of the software without specific, written prior permission.
  666. X *
  667. X *
  668. X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  669. X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  670. X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  671. X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  672. X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  673. X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  674. X * SOFTWARE.
  675. X */
  676. X
  677. X
  678. X
  679. X/*
  680. X * MODIFICATION HISTORY
  681. X *
  682. X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  683. X * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
  684. X *  Western Software Lab. Converted to X11.
  685. X * 002 -- Jordan Hubbard, Ardent Computer.
  686. X *  Changes for titled windows.
  687. X */
  688. X
  689. X#ifndef lint
  690. Xstatic char *sccsid = "@(#)StoreGridBox.c    3.8    1/24/86";
  691. X#endif
  692. X
  693. X/*
  694. X *    StoreGridBox - This subroutine is used by the X Window Manager (xwm)
  695. X *    to store the vertices for the movement resize grid and box in a
  696. X *    vertex list.
  697. X */
  698. X
  699. X#include "awm.h"
  700. X
  701. X/*
  702. X * Store the vertices for the movement resize grid and box in a vertex list.
  703. X */
  704. Xint StoreGridBox(box, ulx, uly, lrx, lry)
  705. Xregister XSegment box[];
  706. Xint ulx;            /* Upper left X coordinate. */
  707. Xint uly;            /* Upper left Y coordinate. */
  708. Xint lrx;            /* Lower right X coordinate. */
  709. Xint lry;            /* Lower right Y coordinate. */
  710. X{
  711. X    register int xthird, ythird;
  712. X    int x1third, y1third;
  713. X    int x2third, y2third;
  714. X
  715. X    Entry("StoreGridBox")
  716. X
  717. X    /*
  718. X     * Xor in.
  719. X     */
  720. X    box[0].x1 = ulx; box[0].y1 = uly;
  721. X    box[0].x2 = lrx; box[0].y2 = uly;
  722. X
  723. X    box[1].x1 = lrx; box[1].y1 = uly;
  724. X    box[1].x2 = lrx; box[1].y2 = lry;
  725. X
  726. X    box[2].x1 = lrx; box[2].y1 = lry;
  727. X    box[2].x2 = ulx; box[2].y2 = lry;
  728. X
  729. X    box[3].x1 = ulx; box[3].y1 = lry;
  730. X    box[3].x2 = ulx; box[3].y2 = uly;
  731. X
  732. X
  733. X    /*
  734. X     * These are the X and Y calculations for the parts of the grid that
  735. X     * are dependent on the division by 3 calculations.
  736. X     */
  737. X
  738. X    /*
  739. X     * Y dimension third.
  740. X     */
  741. X    ythird = (lry - uly) / 3;
  742. X    y1third = uly + ythird;
  743. X    y2third = y1third + ythird;
  744. X   
  745. X    /*
  746. X     * X dimension third.
  747. X     */
  748. X    xthird = (lrx - ulx) / 3;
  749. X    x1third = ulx + xthird;
  750. X    x2third = x1third + xthird;
  751. X
  752. X    box[4].x1 = x1third; box[4].y1 = lry;
  753. X    box[4].x2 = x1third; box[4].y2 = uly;
  754. X
  755. X    box[5].x1 = x2third; box[5].y1 = lry;
  756. X    box[5].x2 = x2third; box[5].y2 = uly;
  757. X
  758. X    box[6].x1 = ulx; box[6].y1 = y1third;
  759. X    box[6].x2 = lrx; box[6].y2 = y1third;
  760. X
  761. X    box[7].x1 = ulx; box[7].y1 = y2third;
  762. X    box[7].x2 = lrx; box[7].y2 = y2third;
  763. X
  764. X    /*
  765. X     * Do not erase if we're freezing the screen.
  766. X     */
  767. X    if (Freeze)
  768. X        Leave(8)
  769. X
  770. X    /*
  771. X     * From here on we're retracing the segments to clear the
  772. X     * grid using GXxor.
  773. X     */
  774. X    box[8].x1 = ulx; box[8].y1 = uly;
  775. X    box[8].x2 = lrx; box[8].y2 = uly;
  776. X
  777. X    box[9].x1 = lrx; box[9].y1 = uly;
  778. X    box[9].x2 = lrx; box[9].y2 = lry;
  779. X
  780. X    box[10].x1 = lrx; box[10].y1 = lry;
  781. X    box[10].x2 = ulx; box[10].y2 = lry;
  782. X
  783. X    box[11].x1 = ulx; box[11].y1 = lry;
  784. X    box[11].x2 = ulx; box[11].y2 = uly;
  785. X
  786. X    box[12].x1 = x1third; box[12].y1 = lry;
  787. X    box[12].x2 = x1third; box[12].y2 = uly;
  788. X
  789. X    box[13].x1 = x2third; box[13].y1 = lry;
  790. X    box[13].x2 = x2third; box[13].y2 = uly;
  791. X
  792. X    box[14].x1 = ulx; box[14].y1 = y1third;
  793. X    box[14].x2 = lrx; box[14].y2 = y1third;
  794. X
  795. X    box[15].x1 = ulx; box[15].y1 = y2third;
  796. X    box[15].x2 = lrx; box[15].y2 = y2third;
  797. X
  798. X
  799. X    /*
  800. X     * Total number of segments is 16.
  801. X     */
  802. X    Leave(16)
  803. X}
  804. X
  805. X/*
  806. X * Store the vertices for the movement resize grid and box in a vertex list.
  807. X * This is just like the routine above, but it adds a line for titled windows.
  808. X */
  809. X
  810. Xint StoreTitleGridBox(box, ulx, uly, lrx, lry)
  811. Xregister XSegment box[];
  812. Xint ulx;            /* Upper left X coordinate. */
  813. Xint uly;            /* Upper left Y coordinate. */
  814. Xint lrx;            /* Lower right X coordinate. */
  815. Xint lry;            /* Lower right Y coordinate. */
  816. X{
  817. X    register int xthird, ythird;
  818. X    int x1third, y1third;
  819. X    int x2third, y2third;
  820. X
  821. X    Entry("StoreTitleGridBox")
  822. X
  823. X    /*
  824. X     * Xor in.
  825. X     */
  826. X    box[0].x1 = ulx; box[0].y1 = uly;
  827. X    box[0].x2 = lrx; box[0].y2 = uly;
  828. X
  829. X    box[1].x1 = ulx; box[1].y1 = uly + titleHeight + 2;
  830. X    box[1].x2 = lrx; box[1].y2 = uly + titleHeight + 2;
  831. X
  832. X    box[2].x1 = lrx; box[2].y1 = uly;
  833. X    box[2].x2 = lrx; box[2].y2 = lry;
  834. X
  835. X    box[3].x1 = lrx; box[3].y1 = lry;
  836. X    box[3].x2 = ulx; box[3].y2 = lry;
  837. X
  838. X    box[4].x1 = ulx; box[4].y1 = lry;
  839. X    box[4].x2 = ulx; box[4].y2 = uly;
  840. X
  841. X
  842. X    /*
  843. X     * These are the X and Y calculations for the parts of the grid that
  844. X     * are dependent on the division by 3 calculations.
  845. X     */
  846. X
  847. X    /*
  848. X     * Y dimension third.
  849. X     */
  850. X    ythird = (lry - uly - titleHeight - 2) / 3;
  851. X    y1third = uly + ythird + titleHeight + 2;
  852. X    y2third = y1third + ythird;
  853. X   
  854. X    /*
  855. X     * X dimension third.
  856. X     */
  857. X    xthird = (lrx - ulx) / 3;
  858. X    x1third = ulx + xthird;
  859. X    x2third = x1third + xthird;
  860. X
  861. X    box[5].x1 = x1third; box[5].y1 = lry;
  862. X    box[5].x2 = x1third; box[5].y2 = uly + titleHeight + 3;
  863. X
  864. X    box[6].x1 = x2third; box[6].y1 = lry;
  865. X    box[6].x2 = x2third; box[6].y2 = uly + titleHeight + 3;
  866. X
  867. X    box[7].x1 = ulx; box[7].y1 = y1third;
  868. X    box[7].x2 = lrx; box[7].y2 = y1third;
  869. X
  870. X    box[8].x1 = ulx; box[8].y1 = y2third;
  871. X    box[8].x2 = lrx; box[8].y2 = y2third;
  872. X
  873. X    /*
  874. X     * Do not erase if we're freezing the screen.
  875. X     */
  876. X    if (Freeze)
  877. X        Leave(9)
  878. X
  879. X    /*
  880. X     * From here on we're retracing the segments to clear the
  881. X     * grid using GXxor.
  882. X     */
  883. X    box[9].x1 = ulx; box[9].y1 = uly;
  884. X    box[9].x2 = lrx; box[9].y2 = uly;
  885. X
  886. X    box[10].x1 = ulx; box[10].y1 = uly + titleHeight + 2;
  887. X    box[10].x2 = lrx; box[10].y2 = uly + titleHeight + 2;
  888. X
  889. X    box[11].x1 = lrx; box[11].y1 = uly;
  890. X    box[11].x2 = lrx; box[11].y2 = lry;
  891. X
  892. X    box[12].x1 = lrx; box[12].y1 = lry;
  893. X    box[12].x2 = ulx; box[12].y2 = lry;
  894. X
  895. X    box[13].x1 = ulx; box[13].y1 = lry;
  896. X    box[13].x2 = ulx; box[13].y2 = uly;
  897. X
  898. X    box[14].x1 = x1third; box[14].y1 = lry;
  899. X    box[14].x2 = x1third; box[14].y2 = uly + titleHeight + 3;
  900. X
  901. X    box[15].x1 = x2third; box[15].y1 = lry;
  902. X    box[15].x2 = x2third; box[15].y2 = uly + titleHeight + 3;
  903. X
  904. X    box[16].x1 = ulx; box[16].y1 = y1third;
  905. X    box[16].x2 = lrx; box[16].y2 = y1third;
  906. X
  907. X    box[17].x1 = ulx; box[17].y1 = y2third;
  908. X    box[17].x2 = lrx; box[17].y2 = y2third;
  909. X
  910. X
  911. X    /*
  912. X     * Total number of segments is 18.
  913. X     */
  914. X    Leave(18)
  915. X}
  916. END_OF_awm/GridBox.c
  917. if test 7858 -ne `wc -c <awm/GridBox.c`; then
  918.     echo shar: \"awm/GridBox.c\" unpacked with wrong size!
  919. fi
  920. # end of overwriting check
  921. fi
  922. if test -f awm/Move.c -a "${1}" != "-c" ; then 
  923.   echo shar: Will not over-write existing file \"awm/Move.c\"
  924. else
  925. echo shar: Extracting \"awm/Move.c\" \(8533 characters\)
  926. sed "s/^X//" >awm/Move.c <<'END_OF_awm/Move.c'
  927. X#ident   "%W% %G%"
  928. X
  929. X
  930. X
  931. X#ifndef lint
  932. Xstatic char *rcsid_Move_c = "$Header: Move.c,v 1.1 88/06/15 15:24:56 jkh Exp $";
  933. X#endif    lint
  934. X
  935. X#include "X11/copyright.h"
  936. X/*
  937. X *
  938. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  939. X *
  940. X * Copyright 1987 by Jordan Hubbard.
  941. X *
  942. X *
  943. X *                         All Rights Reserved
  944. X *
  945. X * Permission to use, copy, modify, and distribute this software and its
  946. X * documentation for any purpose and without fee is hereby granted,
  947. X * provided that the above copyright notice appear in all copies and that
  948. X * both that copyright notice and this permission notice appear in
  949. X * supporting documentation, and that the name of Ardent Computer
  950. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  951. X * pertaining to distribution of the software without specific, written
  952. X * prior permission.
  953. X *
  954. X */
  955. X
  956. X/*
  957. X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  958. X *
  959. X *                         All Rights Reserved
  960. X *
  961. X * Permission to use, copy, modify, and distribute this software and its
  962. X * documentation for any purpose and without fee is hereby granted,
  963. X * provided that the above copyright notice appear in all copies and that
  964. X * both that copyright notice and this permission notice appear in
  965. X * supporting documentation, and that the name of Digital Equipment
  966. X * Corporation not be used in advertising or publicity pertaining to
  967. X * distribution of the software without specific, written prior permission.
  968. X *
  969. X *
  970. X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  971. X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  972. X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  973. X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  974. X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  975. X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  976. X * SOFTWARE.
  977. X */
  978. X
  979. X/*
  980. X * MODIFICATION HISTORY
  981. X *
  982. X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  983. X * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group, 
  984. X *      Western Software Lab. Port to X11
  985. X */
  986. X
  987. X#include "awm.h"
  988. X
  989. XBoolean Move(window, mask, button, x, y)
  990. XWindow window;                /* Event window. */
  991. Xint mask;                /* Button/key mask. */
  992. Xint button;                /* Button event detail. */
  993. Xint x, y;                /* Event mouse position. */
  994. X{
  995. X     register int prev_x;        /* Previous event window X location. */
  996. X     register int prev_y;        /* Previous event window Y location. */
  997. X     XWindowAttributes window_info;    /* Event window information. */
  998. X     int cur_x;                /* Current event window X location. */
  999. X     int cur_y;                /* Current event window Y location. */
  1000. X     int root_x;                /* Root window X location. */
  1001. X     int root_y;                /* Root window Y location. */
  1002. X     int ulx, uly;            /* Event window upper left X and Y. */
  1003. X     int lrx, lry;            /* Event window lower right X and Y. */
  1004. X     int init_ulx, init_uly;        /* Init window upper left X and Y. */
  1005. X     int init_lrx, init_lry;        /* Init window lower right X and Y. */
  1006. X     int num_vectors;            /* Number of vectors in box. */
  1007. X     int ptrmask;            /* state of ptr when queried */
  1008. X     Window sub_window;            /* Query mouse event sub-window. */
  1009. X     Window root;            /* Query mouse event root. */
  1010. X     AwmInfoPtr awi;
  1011. X     XEvent button_event;        /* Button event packet. */
  1012. X     XSegment box[MAX_BOX_VECTORS];    /* Box vertex buffer. */
  1013. X     XSegment zap[MAX_ZAP_VECTORS];    /* Zap effect verted buffer. */
  1014. X     int (*storegrid_func)();        /* Function to use for grid */
  1015. X     int (*storebox_func)();        /* Function to use for box */
  1016. X     
  1017. X     Entry("Move")
  1018. X      
  1019. X     /*
  1020. X      * Do not try to move the root window.
  1021. X      */
  1022. X     if (window == RootWindow(dpy, scr))
  1023. X      Leave(FALSE)
  1024. X            
  1025. X     /*
  1026. X      * Change the cursor.
  1027. X      */
  1028. X     grab_pointer();
  1029. X     /*
  1030. X      * Clear the vector buffers.
  1031. X      */
  1032. X     bzero(box, sizeof(box));
  1033. X     if (Zap)
  1034. X      bzero(zap, sizeof(zap));
  1035. X     
  1036. X     /*
  1037. X      * Gather info on the event window.
  1038. X      */
  1039. X     awi = GetAwmInfo(window);
  1040. X     if (!awi)
  1041. X      Leave(FALSE)
  1042. X     status = XGetWindowAttributes(dpy, window, &window_info);
  1043. X     if (status == FAILURE)
  1044. X      Leave(FALSE)
  1045. X
  1046. X     if (awi->title && !IsIcon(window, NULL)) {
  1047. X      storegrid_func = StoreTitleGridBox;
  1048. X      storebox_func = StoreTitleBox;
  1049. X     }
  1050. X     else {
  1051. X      storegrid_func = StoreGridBox;
  1052. X      storebox_func = StoreBox;
  1053. X     }
  1054. X     /*
  1055. X      * Initialize movement variables.
  1056. X      */
  1057. X     init_ulx = ulx = window_info.x;
  1058. X     init_uly = uly = window_info.y;
  1059. X     init_lrx = lrx = window_info.x + window_info.width +
  1060. X      (window_info.border_width << 1) - 1;
  1061. X     init_lry = lry = window_info.y + window_info.height +
  1062. X      (window_info.border_width << 1) - 1;
  1063. X     
  1064. X     /*
  1065. X      * Store the box.
  1066. X      */
  1067. X     if (Grid)
  1068. X      num_vectors = (*storegrid_func)(box, ulx, uly, lrx, lry);
  1069. X     else
  1070. X      num_vectors = (*storebox_func)(box, ulx, uly, lrx, lry);
  1071. X     
  1072. X     /*
  1073. X      * Initialize the previous location variables.
  1074. X      */
  1075. X     prev_x = x;
  1076. X     prev_y = y;
  1077. X     
  1078. X     /*
  1079. X      * Freeze the server, if requested by the user.
  1080. X      * This results in a solid box instead of a flickering one.
  1081. X      */
  1082. X     if (Freeze)
  1083. X      XGrabServer(dpy);
  1084. X     Snatched = True;
  1085. X     /*
  1086. X      * Process any pending exposure events before drawing the box.
  1087. X      */
  1088. X     while (QLength(dpy) > 0) {
  1089. X      XPeekEvent(dpy, &button_event);
  1090. X      if (((XAnyEvent *)&button_event)->window == RootWindow(dpy, scr))
  1091. X           break;
  1092. X      GetButton(&button_event);
  1093. X     }
  1094. X     
  1095. X     /*
  1096. X      * Now draw the box.
  1097. X      */
  1098. X     
  1099. X     DrawBox();
  1100. X     Frozen = window;
  1101. X     
  1102. X     /*
  1103. X      * Main loop.
  1104. X      */
  1105. X     while (TRUE) {
  1106. X      
  1107. X      /*
  1108. X       * Check to see if we have a change in mouse button status.
  1109. X       * This is how we get out of this "while" loop.
  1110. X       */
  1111. X      if (XPending(dpy) && !ProcessRequests(box, num_vectors) &&
  1112. X          GetButton(&button_event)) {
  1113. X           /*
  1114. X        * Process the pending events, this sequence is the only
  1115. X        * way out of the loop and the routine.
  1116. X        */
  1117. X           
  1118. X           if ((button_event.type != ButtonPress) && 
  1119. X           (button_event.type != ButtonRelease)) {
  1120. X            continue; /* spurious menu event... */
  1121. X           }
  1122. X           
  1123. X           /*
  1124. X        * If we froze the server, then erase the last lines drawn.
  1125. X        */
  1126. X           if (Freeze) {
  1127. X            DrawBox();
  1128. X            Frozen = (Window)0;
  1129. X            XUngrabServer(dpy);
  1130. X           }
  1131. X           
  1132. X           if ((button_event.type == ButtonRelease) &&
  1133. X           (((XButtonReleasedEvent *)&button_event)->button == button)) {
  1134. X            
  1135. X            /*
  1136. X             * The button was released, so move the window.
  1137. X             */
  1138. X            
  1139. X            if (Zap) {
  1140. X             num_vectors = StoreZap(zap,
  1141. X                        init_ulx, init_uly,
  1142. X                        init_lrx, init_lry,
  1143. X                        ulx, uly,
  1144. X                        lrx, lry);
  1145. X             DrawZap();
  1146. X             DrawZap();
  1147. X            }
  1148. X#ifdef titan /* 5x4 alignment */
  1149. X            ulx += (ulx % 5);
  1150. X            uly += (uly % 4);
  1151. X#endif /* titan */
  1152. X            if (Wall) {
  1153. X             if (ulx < 0)
  1154. X                  ulx = 0;
  1155. X             if (ulx > (ScreenWidth - window_info.width))
  1156. X                  ulx = (ScreenWidth - window_info.width);
  1157. X             if (uly < 0)
  1158. X                  uly = 0;
  1159. X             if (uly > (ScreenHeight - window_info.height))
  1160. X                  uly = (ScreenHeight - window_info.height);
  1161. X            }
  1162. X            XMoveWindow(dpy, window, ulx, uly);
  1163. X            Snatched = False;
  1164. X            ungrab_pointer();
  1165. X            Leave(TRUE)
  1166. X           }
  1167. X           else {
  1168. X            /*
  1169. X             * Some other button event occured, this aborts the
  1170. X             * current operation.
  1171. X             */
  1172. X            
  1173. X            ResetCursor(button);
  1174. X            Snatched = False;
  1175. X            ungrab_pointer();
  1176. X            Leave(TRUE)
  1177. X           }
  1178. X      }
  1179. X      
  1180. X      /*
  1181. X       * Take care of all the little things that have changed.
  1182. X       */
  1183. X      XQueryPointer(dpy, 
  1184. X            RootWindow(dpy, scr), &root,  &sub_window,
  1185. X            &root_x, &root_y, &cur_x, &cur_y, &ptrmask);
  1186. X      if ((cur_x != prev_x) || (cur_y != prev_y)) {
  1187. X           
  1188. X           /*
  1189. X        * If we've frozen the server, then erase the old box first!
  1190. X        */
  1191. X           if (Freeze)
  1192. X            DrawBox();
  1193. X           
  1194. X           /*
  1195. X        * Box position has changed.
  1196. X        */
  1197. X           ulx += cur_x - prev_x;
  1198. X           uly += cur_y - prev_y;
  1199. X           lrx += cur_x - prev_x;
  1200. X           lry += cur_y - prev_y;
  1201. X           
  1202. X           /*
  1203. X        * Box needs to be restored.
  1204. X        */
  1205. X           if (Grid)
  1206. X            num_vectors = (*storegrid_func)(box, ulx, uly, lrx, lry);
  1207. X           else
  1208. X            num_vectors = (*storebox_func)(box, ulx, uly, lrx, lry);
  1209. X           
  1210. X           
  1211. X           /*
  1212. X        * Draw the new box.
  1213. X        */
  1214. X           if (Freeze)
  1215. X            DrawBox();
  1216. X      }
  1217. X      
  1218. X      /* 
  1219. X       * Save old box position.
  1220. X       */
  1221. X      prev_x = cur_x;
  1222. X      prev_y = cur_y;
  1223. X      
  1224. X      /*
  1225. X       * If server is not frozen, then draw the "flicker" box.
  1226. X       */
  1227. X      if (!Freeze) {
  1228. X           DrawBox();
  1229. X           DrawBox();
  1230. X      }
  1231. X     }
  1232. X}
  1233. END_OF_awm/Move.c
  1234. if test 8533 -ne `wc -c <awm/Move.c`; then
  1235.     echo shar: \"awm/Move.c\" unpacked with wrong size!
  1236. fi
  1237. # end of overwriting check
  1238. fi
  1239. if test -f awm/README -a "${1}" != "-c" ; then 
  1240.   echo shar: Will not over-write existing file \"awm/README\"
  1241. else
  1242. echo shar: Extracting \"awm/README\" \(7354 characters\)
  1243. sed "s/^X//" >awm/README <<'END_OF_awm/README'
  1244. XThis represents the first real release of the Ardent Window Manager (awm).
  1245. XIt's being released on the same terms as its predecessor (uwm) with
  1246. Xone additional request: Since this window manager is the "official"
  1247. Xwindow manager of Ardent Computer, a lot more effort and time will
  1248. Xbe expended to ensure that it works reliably. Please try and coordinate
  1249. Xfixes and enhancements through Ardent so that all may benefit. There
  1250. Xare sure to be some bugs, we'll be here trying to fix them. Send
  1251. Xbug reports to the author, or to:
  1252. X
  1253. X    {decwrl, uunet, hplabs, ucbcad, dlb}!ardent!awm-bugs
  1254. X
  1255. X
  1256. XINSTALLATION:
  1257. X
  1258. XInstallation should be fairly straightforward. If you're using imake,
  1259. Xfirst modify $(TOPDIR)/util/imake.includes/Imake.tmpl to define a macro
  1260. Xcalled AWMDIR (look at UWMDIR for an example) which should point to
  1261. Xsomeplace where you want to stash the system.awmrc file. If you like,
  1262. Xyou can just make UWMDIR and AWMDIR point to the same place since uwm
  1263. Xand awm's file names are different and won't conflict with eachother. If
  1264. Xyou're using make (and don't want to use imake), modify the definition
  1265. Xof AWMDIR in the Makefile instead (sort of the wrong way to do it though).
  1266. X
  1267. XCertain compilers don't like the #ident lines we use for sccs. If yours
  1268. Xdoesn't, do a
  1269. X
  1270. X    make noident
  1271. X
  1272. XIn the awm directory to remove all #ident lines from the source code.
  1273. X
  1274. XThe usual differences between system V and BSD include file structures
  1275. Xmay also cause you trouble. In particular, <sys/time.h> may be different.
  1276. XIf FocusChng.c doesn't compile correctly on your system, see if the
  1277. Xcorrect include file is in /usr/include or /usr/include/sys (the correct
  1278. Xone should define a timeval struct). I've also heard that SunOS 4.0
  1279. Xfails to compile code that compiles fine on SunOS 3.x. I don't know
  1280. Xwhat the symptoms are (since I don't have a 4.0 system around), but
  1281. XI've heard that the fix is to include <sys/file.h> in exp_path.c and
  1282. Xawm.c.
  1283. X
  1284. XIf you want awm's output to go to the console device (assumed to be
  1285. X/dev/console), define CONSOLE in the I/Makefile (there are appropriate
  1286. Xcomments that will show you what to do).
  1287. X
  1288. XThere's a file named XRdBitFD.c which contains a new Xlib routine called
  1289. XXReadBitmapFileData(). Awm uses this routine quite a bit, so you should install
  1290. Xit as part of your Xlib before compiling awm. Just move the file named
  1291. X"XRdBitFD.c" to lib/X and modify lib/X/Imakefile (or lib/X/Makefile if you
  1292. Xdon't use imake) to compile it with the rest of the library.
  1293. XIf this is not possible, look in the Imakefile/Makefile for the right
  1294. Xdefine to enable compilation with awm rather than the library.
  1295. X
  1296. XThe reason I wrote this routine was that the only two routines for
  1297. Xdealing with (reading in) bitmap files were XReadBitmapFile() and
  1298. XXCreatePixmapFromBitmapData().
  1299. XXReadBitmapFile() returns a depth one pixmap, with no opportunity
  1300. Xto specify either depth or color (evil). XCreatePixmapFromBitmapData()
  1301. Xallows this, but assumes that you've already got ahold of the
  1302. Xdata somehow. XReadBitmapFileData() takes care of that part.
  1303. XIt's my personal feeling that XReadBitmapFile() is about due
  1304. Xfor extinction.
  1305. X
  1306. XIf all this seems confusing, send me mail and I'll try to explain
  1307. Xit differently.
  1308. X
  1309. XSupport for the RTL Neaten package has been added. If you'd like to compile
  1310. Xit in, you need to do two things:
  1311. X
  1312. X  1. Obtain the RTL neaten package somehow. It's too big to bundle with awm,
  1313. X     so it's expected that you'll have obtained it by some other means.
  1314. X     If you are on a system V system with 14 character file names,
  1315. X     you're in for a bit for work. Many of the files in the neaten
  1316. X     package have very long names. After you've renamed all of the > 14 char
  1317. X     files, you'll want to modify Makefile.rtl (in the awm directory)
  1318. X     identically so that the file names match the new ones you've chosen.
  1319. X
  1320. X  2. The makefile that comes with the neaten package assumes that you want to
  1321. X     compile their neatening window manager (nuwm), so you don't want to use
  1322. X     that. Awm will automatically use the "Makefile.rtl" makefile to compile
  1323. X     the neaten package (see below), as long as it knows where you've put it.
  1324. X     Modify awm's Imakefile (or Makefile) to point to the directory
  1325. X     where neaten resides (the macro NEATEN_LIB) and uncomment/comment the
  1326. X     appropriate macro definition lines.
  1327. X
  1328. X  3. Do an imake/make. The make will compile all of awm's files and then
  1329. X     proceed to make a neaten.a (in the neaten directory) to link against.
  1330. X
  1331. X
  1332. X   If you don't compile awm with Neaten, the function f.neaten can
  1333. X   still be bound but it will just print a warning message if invoked.
  1334. X
  1335. X   Please note that the Neaten package has not been extensively tested with
  1336. X   awm and should be considered an experimental "frill" more than anything else.
  1337. X   It seems to shuffle icons around ok, though I don't understand some of its
  1338. X   window placement logic. If it's useful, use it, if not, don't compile it in.
  1339. X
  1340. X
  1341. XThe rtl menu package in menus (non-optional) has its own Makefile which
  1342. Xyou may wish to customize (compiler flags, compiler type, etc), though
  1343. Xthe default configuration should produce a working awm binary on your
  1344. Xsystem. This whole setup needs to be gone through and redone, but that will
  1345. Xhave to wait for another day (or a kind volunteer).
  1346. X
  1347. X
  1348. XFirst time users of awm will probably want to read the manual page carefully
  1349. Xand then set about tailoring their .Xdefaults file accordingly. The actual
  1350. Xformat of the .awmrc file does not differ substantially from uwm's .uwmrc file,
  1351. Xbut since much of the variable declaration stuff has been moved into .Xdefaults,
  1352. Xa .uwmrc file will fail miserably if blithly copied into a .awmrc file. It's
  1353. Xprobably easier to go from scratch, starting with .Xdefaults.
  1354. X
  1355. XAfter defaults have been entered (by far the largest task), a careful
  1356. Xexamination of your current uwm interface should be done to see what possible
  1357. Xbenefits might be derived from title bar, gadget and border contexts.
  1358. XYou will most likely be able to eliminate almost all "chorded" buttons and
  1359. Xgo to naked buttons on title bars/gadgets/borders. You can now also bind
  1360. Xnaked buttons to icons without having the button stolen from applications,
  1361. Xso it's usually a win to bind an f.iconify to the icon context if you like the
  1362. Xway X10's xterm used to work.
  1363. X
  1364. XHighlighting is a new feature which does quite a bit more than just tweak
  1365. Xborder colors. It will change the title bar text font (and redisplay the text)
  1366. Xas well as alternating between two different title bar background pixmaps and
  1367. Xor border context pixmaps.
  1368. X
  1369. XI use a blank pixmap for the regular background (which is the default, I.E.
  1370. XI don't declare one) and a pixmap containing 7 horizontal lines for the
  1371. XBoldPixmap.  The effect is not unlike a macintosh window. With some careful
  1372. Xartistry (and placement) of gadget boxes, one could probably emulate this
  1373. Xeven more closely, though I'm not sure why one would want to.
  1374. X
  1375. XWhen creating gadget box pixmaps, it's suggested that you look at the cursor
  1376. Xfont first as there are a lot of suitable glyphs already there.
  1377. X
  1378. X
  1379. XAny and all suggestions are, of course, appreciated. In addition to the
  1380. Xawm-bugs address given previously, you may communicate with the author
  1381. Xat any of the following addresses:
  1382. X
  1383. X
  1384. X            Author:        Jordan Hubbard
  1385. X            Internet:    jkh@violet.berkeley.edu
  1386. X            UUCP:        {decwrl, hplabs, uunet}!ardent!jkh
  1387. X            U.S. Mail:    Ardent Computer
  1388. X                    880 Maude
  1389. X                    Sunnyvale, Ca. 94086
  1390. X
  1391. X
  1392. X                
  1393. END_OF_awm/README
  1394. if test 7354 -ne `wc -c <awm/README`; then
  1395.     echo shar: \"awm/README\" unpacked with wrong size!
  1396. fi
  1397. # end of overwriting check
  1398. fi
  1399. if test -f awm/menus/rtlmenu.c -a "${1}" != "-c" ; then 
  1400.   echo shar: Will not over-write existing file \"awm/menus/rtlmenu.c\"
  1401. else
  1402. echo shar: Extracting \"awm/menus/rtlmenu.c\" \(9320 characters\)
  1403. sed "s/^X//" >awm/menus/rtlmenu.c <<'END_OF_awm/menus/rtlmenu.c'
  1404. X#ident   "%W% %G%"
  1405. X
  1406. X#ifndef lint
  1407. X     static char sccs_id[] = "@(#)rtlmenu.c    2.1 12/16/87  Siemens Corporate Research and Support, Inc.";
  1408. X#endif
  1409. X
  1410. X
  1411. X/* 
  1412. X  RTL Menu Package Version 1.0
  1413. X  by Joe Camaratta and Mike Berman, Siemens RTL, Princeton NJ, 1987
  1414. X  
  1415. X  rtlmenu.c: interface level for menu package
  1416. X  */
  1417. X
  1418. X#include "X11/copyright.h"
  1419. X/*
  1420. X *
  1421. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  1422. X *
  1423. X * Copyright 1987 by Jordan Hubbard.
  1424. X *
  1425. X *
  1426. X *                         All Rights Reserved
  1427. X *
  1428. X * Permission to use, copy, modify, and distribute this software and its
  1429. X * documentation for any purpose and without fee is hereby granted,
  1430. X * provided that the above copyright notice appear in all copies and that
  1431. X * both that copyright notice and this permission notice appear in
  1432. X * supporting documentation, and that the name of Ardent Computer
  1433. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  1434. X * pertaining to distribution of the software without specific, written
  1435. X * prior permission.
  1436. X *
  1437. X */
  1438. X
  1439. X/*
  1440. X  
  1441. X  Copyright 1987 by
  1442. X  Siemens Corporate Research and Support, Inc., Princeton, New Jersey
  1443. X  
  1444. X  Permission to use, copy, modify, and distribute this software
  1445. X  and its documentation for any purpose and without fee is
  1446. X  hereby granted, provided that the above copyright notice
  1447. X  appear in all copies and that both that copyright notice and
  1448. X  this permission notice appear in supporting documentation, and
  1449. X  that the name of Siemens not be used in advertising or
  1450. X  publicity pertaining to distribution of the software without
  1451. X  specific, written prior permission.  Siemens makes no
  1452. X  representations about the suitability of this software for any
  1453. X  purpose.  It is provided "as is" without express or implied
  1454. X  warranty.
  1455. X  
  1456. X  */
  1457. X
  1458. X#include <stdio.h>
  1459. X#include "X11/Xlib.h"
  1460. X
  1461. X#include "menu.h"
  1462. X#include "menu.def.h"
  1463. X#include "menu.ext.h"
  1464. X#include "rtlmenu.h"
  1465. X#include "dbug.h"
  1466. X
  1467. Xextern Display *dpy;
  1468. Xextern int scr;
  1469. X
  1470. Xstatic RTLPoint menu_pos;
  1471. Xstatic int initialized = 0;
  1472. X     
  1473. Xvoid RTLMenu_Initialize (options_mask)
  1474. XMenuOptionsMask options_mask;
  1475. X{
  1476. X     Entry("RTLMenu_Initialize")
  1477. X
  1478. X     if (initialized)
  1479. X      return;
  1480. X     initialized = 1;
  1481. X     InitMenu ("uwm", options_mask);
  1482. X     Leave_void
  1483. X}
  1484. X
  1485. X/* ------------------------------------------------------------ */
  1486. XRTLMenu RTLMenu_Create()
  1487. X{
  1488. X     Entry("RTLMenu_Create")
  1489. X     /* Create a menu with no name, not in inverse video. */
  1490. X     
  1491. X     Leave((RTLMenu)NewMenu())
  1492. X}
  1493. X
  1494. X/* ------------------------------------------------------------ */
  1495. Xvoid RTLMenu_Destroy( menu )
  1496. XRTLMenu menu;
  1497. X{
  1498. X     Entry("RTLMenu_Destroy")
  1499. X     DisposeMenu ((Menu*) menu);
  1500. X     Leave_void
  1501. X}
  1502. X
  1503. X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
  1504. X
  1505. Xpointer RTLMenu_Data( menu, item )
  1506. X/*ARGSUSED*/
  1507. XRTLMenu menu;
  1508. XRTLMenuItem item;
  1509. X{
  1510. X     Entry("RTLMenu_Data")
  1511. X     Leave(ItemData((MenuItem*)item))
  1512. X}
  1513. X
  1514. X/* ------------------------------------------------------------ */
  1515. X
  1516. XRTLMenu RTLMenu_Get_Submenu( menu, str )
  1517. XRTLMenu menu;
  1518. Xchar *str;
  1519. X{
  1520. X     MenuItem *item = MenuItemByName ((Menu*) menu, str);
  1521. X     Entry("RTLMenu_Get_Submenu")
  1522. X
  1523. X     if (!ItemIsNull(item))
  1524. X      Leave((RTLMenu)ItemSubmenu(item))
  1525. X     Leave(0)
  1526. X}
  1527. X
  1528. X /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
  1529. X
  1530. X/*ARGSUSED*/
  1531. Xstatic void RTLMenu_Client_Send( menu, item )
  1532. XRTLMenu menu;
  1533. XRTLMenuItem item;
  1534. X{
  1535. X     Entry("RTLMenu_Client_Send")
  1536. X
  1537. X     printf ("RTLMenu_Client_Send not yet implemented for X, string = \"%s\"\n",
  1538. X         (char*) item);
  1539. X     Leave_void
  1540. X}
  1541. X
  1542. X/* ------------------------------------------------------------ */
  1543. X
  1544. XRTLMenuItem RTLMenu_Append_String( menu, str, strval )
  1545. XRTLMenu menu;
  1546. Xchar *str;
  1547. Xchar *strval;
  1548. X{
  1549. X     MenuItem *item = AddMenuItem((Menu*)menu, str);
  1550. X     Entry("RTLMenu_Append_String")
  1551. X
  1552. X     ItemCallback(item) = (Callback)RTLMenu_Client_Send;
  1553. X     ItemData(item) = (pointer) strval;
  1554. X     Leave((RTLMenuItem)item)
  1555. X}
  1556. X
  1557. X/* ------------------------------------------------------------ */
  1558. X
  1559. XRTLMenuItem RTLMenu_Append_Callback( menu, backproc )
  1560. XRTLMenu menu;
  1561. XVoidFunc backproc;
  1562. X{
  1563. X     MenuItem *item = AddMenuItem((Menu*)menu, "");
  1564. X     Entry("RTLMenu_Append_Callback")
  1565. X
  1566. X     ItemGenerator(item) = (Callback)backproc;
  1567. X     
  1568. X     Leave((RTLMenuItem)item)
  1569. X}
  1570. X
  1571. X /* ------------------------------------------------------------ */
  1572. X
  1573. XRTLMenuItem RTLMenu_Append_Call( menu, str, pix, proc, ptrval )
  1574. XRTLMenu menu;
  1575. Xchar *str;
  1576. Xchar *pix;
  1577. XVoidFunc proc;
  1578. Xpointer ptrval;
  1579. X{
  1580. X     MenuItem *item = AddMenuItem((Menu*)menu, str, pix);
  1581. X     
  1582. X     Entry("RTLMenu_Append_Call")
  1583. X
  1584. X     ItemCallback(item) = proc;
  1585. X     ItemData(item) = ptrval;
  1586. X     
  1587. X     Leave((RTLMenuItem)item)
  1588. X}
  1589. X
  1590. X/* ------------------------------------------------------------ */
  1591. X
  1592. XRTLMenuItem RTLMenu_Append_Checkback( menu, str, pix, checkproc, proc, ptrval )
  1593. XRTLMenu menu;
  1594. Xchar *str;   /* Menu string */
  1595. Xchar *pix;
  1596. Xbool (*checkproc) ();  /* Boolean function called when menu entry
  1597. X              is about to be displayed.  If true, then
  1598. X              the item appears checked; if false, then
  1599. X              it does not */
  1600. XVoidFunc proc;  /* function to be called when the item 
  1601. X           is selected */
  1602. Xpointer ptrval; /* data associated with this item */
  1603. X{
  1604. X     MenuItem *item = AddMenuItem((Menu*)menu, str, pix);
  1605. X     Entry("RTLMenu_Append_Checkback")
  1606. X
  1607. X     ItemCallback(item) = proc;
  1608. X     ItemData(item) = ptrval;
  1609. X     ItemCheckproc(item) =  checkproc;
  1610. X     
  1611. X     Leave((RTLMenuItem)item)
  1612. X}
  1613. X/* ------------------------------------------------------------ */
  1614. X
  1615. XRTLMenuItem RTLMenu_Append_Submenu( menu, str, pix, submenu )
  1616. XRTLMenu menu;
  1617. Xchar *str;
  1618. Xchar *pix;
  1619. XRTLMenu submenu;
  1620. X{
  1621. X     MenuItem *item = AddMenuItem((Menu*)menu, str, pix);
  1622. X     Entry("RTLMenu_Append_Submenu")
  1623. X
  1624. X     ItemSubmenu(item) = (Menu*)submenu;
  1625. X     
  1626. X     Leave((RTLMenuItem)item)
  1627. X}
  1628. X
  1629. X /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
  1630. X
  1631. Xvoid RTLMenu_Replace_Data_Keyed_String( menu, data, str )
  1632. XRTLMenu menu;
  1633. Xpointer data;
  1634. Xchar *str;
  1635. X{
  1636. X     MenuItem *item = MenuItemByName((Menu*) menu, str);
  1637. X     Entry("RTLMenu_Replace_Keyed_String")
  1638. X
  1639. X     if (!ItemIsNull(item))
  1640. X      ItemData(item) = data;
  1641. X     Leave_void
  1642. X} 
  1643. X
  1644. X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
  1645. X
  1646. Xvoid RTLMenu_Activate_Entry( menu, item )
  1647. XRTLMenu menu;
  1648. XRTLMenuItem item;
  1649. X{
  1650. X     Entry("RTLMenu_Activate_Entry")
  1651. X
  1652. X     (void)SetItemDisable((Menu*)menu, (MenuItem*)item, FALSE);
  1653. X     Leave_void
  1654. X}
  1655. X
  1656. X/* ------------------------------------------------------------ */    
  1657. X
  1658. Xvoid RTLMenu_Inactivate_Entry( menu, item )
  1659. XRTLMenu menu;
  1660. XRTLMenuItem item;
  1661. X{
  1662. X     Entry("RTLMenu_Inactivate_Entry")
  1663. X
  1664. X     (void)SetItemDisable((Menu*)menu, (MenuItem*)item, TRUE);
  1665. X     Leave_void
  1666. X}
  1667. X
  1668. Xvoid RTLMenu_Label_Entry( menu, item )
  1669. XRTLMenu menu;
  1670. XRTLMenuItem item;
  1671. X{
  1672. X     Entry("RTLMenu_Label_Entry")
  1673. X
  1674. X     (void)SetItemDeaf((Menu*)menu, (MenuItem*)item, TRUE);
  1675. X     Leave_void
  1676. X}
  1677. X
  1678. X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
  1679. X
  1680. Xbool RTLMenu_Has_Data( menu, val )
  1681. XRTLMenu menu;
  1682. Xpointer val;
  1683. X{
  1684. X     MenuItem *item = MenuItemByData((Menu*)menu, val);
  1685. X     Entry("RTLMenu_Has_Data")
  1686. X
  1687. X     Leave(!ItemIsNull(item))
  1688. X}
  1689. X
  1690. X /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
  1691. X
  1692. Xvoid RTLMenu_Delete_Entries( menu )
  1693. XRTLMenu menu;
  1694. X{
  1695. X     Entry("RTLMenu_Delete_Entries")
  1696. X
  1697. X     while (DisposeItem((Menu*)menu, MenuItems((Menu*)menu)));
  1698. X     Leave_void
  1699. X}
  1700. X
  1701. X/* ------------------------------------------------------------ */
  1702. X
  1703. Xvoid RTLMenu_Delete_String( menu, str )
  1704. XRTLMenu menu;
  1705. Xchar *str;
  1706. X{
  1707. X     MenuItem *item = MenuItemByName((Menu*) menu, str);
  1708. X     
  1709. X     Entry("RTLMenu_Delete_String");
  1710. X
  1711. X     if (!ItemIsNull(item))
  1712. X      (void) DisposeItem ((Menu*)menu, item);
  1713. X     Leave_void
  1714. X}
  1715. X
  1716. X/* ------------------------------------------------------------ */
  1717. X
  1718. Xvoid RTLMenu_Delete_Data( menu, val )
  1719. XRTLMenu menu;
  1720. Xpointer val;
  1721. X{
  1722. X     MenuItem *item = MenuItemByData((Menu*)menu, val);
  1723. X     
  1724. X     Entry("RTLMenu_Delete_Data");
  1725. X
  1726. X     if (!ItemIsNull(item))
  1727. X      (void) DisposeItem((Menu*)menu, item);
  1728. X     Leave_void
  1729. X}
  1730. X
  1731. X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
  1732. X
  1733. X/*ARGSUSED*/
  1734. Xvoid RTLMenu_Box( menu )
  1735. XRTLMenu menu;
  1736. X{
  1737. X     /* Commented out */
  1738. X}
  1739. X
  1740. X /* ------------------------------------------------------------ */
  1741. X
  1742. X/*ARGSUSED*/
  1743. Xvoid RTLMenu_Enter( menu, butnum, buttime, base_window, pos )
  1744. XRTLMenu menu;
  1745. Xint butnum;
  1746. XTime buttime;
  1747. XWindow base_window;
  1748. XRTLPoint pos;
  1749. X{
  1750. X     MenuItem *selected;
  1751. X     
  1752. X     Entry("RTLMenu_Enter")
  1753. X
  1754. X     menu_pos = pos;
  1755. X     selected = TrackMenu ((Menu*) menu, menu_pos.x, menu_pos.y,
  1756. X               butnum, base_window, buttime);
  1757. X     if (!ItemIsNull(selected))
  1758. X      (ItemCallback(selected)) (menu, selected, base_window);
  1759. X     Leave_void
  1760. X}
  1761. X/* ------------------------------------------------------------ */
  1762. X
  1763. XRTLPoint RTLMenu_Entry_Pos()
  1764. X{
  1765. X     Entry("RTLMenu_Entry_Pos")
  1766. X     /* menu_pos is a global static that gets set by the call to */
  1767. X     /* XQueryPointer that is used by the TrackMenu call.        */
  1768. X     
  1769. X     Leave(menu_pos)
  1770. X}
  1771. X
  1772. X
  1773. Xvoid RTLMenu_Generate_Items(menu, proc)
  1774. X/* apply VoidFunc proc to each item in the menu, with       */
  1775. X/* arguments menu and menuItem                              */
  1776. XRTLMenu menu;
  1777. XVoidFunc proc;
  1778. X{
  1779. X     MenuItem *item;
  1780. X     
  1781. X     Entry("RTLMenu_Generate_Items")
  1782. X
  1783. X     for (item = MenuItems((Menu*)menu);
  1784. X      !ItemIsNull(item); item = ItemNext(item))
  1785. X     {
  1786. X      (proc)((RTLMenu)menu, (RTLMenuItem)item);
  1787. X     }
  1788. X     Leave_void
  1789. X}
  1790. END_OF_awm/menus/rtlmenu.c
  1791. if test 9320 -ne `wc -c <awm/menus/rtlmenu.c`; then
  1792.     echo shar: \"awm/menus/rtlmenu.c\" unpacked with wrong size!
  1793. fi
  1794. # end of overwriting check
  1795. fi
  1796. echo shar: End of archive 5 \(of 13\).
  1797. cp /dev/null ark5isdone
  1798. MISSING=""
  1799. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
  1800.     if test ! -f ark${I}isdone ; then
  1801.     MISSING="${MISSING} ${I}"
  1802.     fi
  1803. done
  1804. if test "${MISSING}" = "" ; then
  1805.     echo You have unpacked all 13 archives.
  1806.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1807. else
  1808.     echo You still need to unpack the following archives:
  1809.     echo "        " ${MISSING}
  1810. fi
  1811. ##  End of shell archive.
  1812. exit 0
  1813. Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
  1814.